{extend name='public/base' /}
{block name='content'}
{include file='public/content_header' /}
<section class="content">
    <div class="row">
        <div class="col-md-12">
            <div class="box box-primary">
                <!-- 表单头部 -->
                <div class="box-header with-border">
                    <div class="btn-group">
                        <a class="btn flat btn-sm btn-default BackButton">
                            <i class="fa fa-arrow-left"></i>
                            返回
                        </a>
                    </div>
                </div>
                <!-- 表单 -->
                <form id="dataForm" class="form-horizontal dataForm" action="" method="post"
                      enctype="multipart/form-data">
                    <!-- 表单字段区域 -->
                    <div class="box-body">
                        <div class="form-group">
                            <label style="width: 370px;" for="fname" class="col-sm-2 control-label">所属父级标签</label>
                            <div class="col-sm-10" style="width: 800px;">
                                <input id="fname" readonly value="{$finfo.label_name|default=''}"
                                       placeholder="所属父级标签" type="text" class="form-control field-text">
                            </div>
                        </div>

                        <div class="form-group">
                            <label style="width: 370px;" for="label_name" class="col-sm-2 control-label">子标签名称</label>
                            <div class="col-sm-10" style="width: 800px;">
                                <input id="label_name" name="label_name" value="{$data.label_name|default=''}"
                                       placeholder="请输入子标签名称" type="text" class="form-control field-text">
                            </div>
                        </div>

                        <div class="form-group">
                            <label style="width: 370px;" for="status" class="col-sm-2 control-label">标签状态</label>
                            <div class="col-sm-10 col-md-4" style="width: 800px;">
                                <select name="status" id="status" class="form-control field-select" data-placeholder="请选择标签状态">
                                    <option value="1" {if isset($data.status) && $data.status==1}selected{/if}>显示</option>
                                    <option value="2" {if isset($data.status) && $data.status==2}selected{/if}>隐藏</option>
                                </select>
                            </div>
                        </div>

                        <div class="form-group">
                            <label style="width: 370px;" for="sort" class="col-sm-2 control-label">展示排序（越小越靠前）</label>
                            <div class="col-sm-10" style="width: 800px;">
                                <input id="sort" name="sort" value="{$data.sort|default='0'}"
                                       placeholder="请输入排序" type="number" class="form-control field-text">
                            </div>
                        </div>

                        <input name="id" type="hidden" value="{$data.id|raw|default=''}">
                        <input name="fid" type="hidden" value="{$fid|raw|default=''}">

                    </div>
                    <!-- 表单底部 -->
                    <div class="box-footer">
                        <div class="col-sm-2"  style="width: 370px;">
                        </div>
                        <div class="col-sm-10 col-md-4">
                            <div class="btn-group">
                                <button type="submit" class="btn flat btn-info dataFormSubmit">
                                    {if isset($data.id)}
                                        确认修改
                                    {elseif !isset($data.id)}
                                        确认添加
                                    {/if}
                                </button>
                            </div>
                            <div class="btn-group">
                                <button type="reset" class="btn flat btn-default dataFormReset">
                                    重置
                                </button>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</section>
<script>
    /** 表单验证 **/
    $('#dataForm').validate({
        rules: {
            'label_name': {
                required: true,
            },
        },
        messages: {
            'label_name': {
                required: "标签名称不能为空",
            },
        }
    });
</script>
{/block}